package cn.com.sparkle.paxos;

import cn.com.sparkle.paxos.iomodel.protobuffmessage.PaxosMessages.ElectionId;
import cn.com.sparkle.paxos.iomodel.protobuffmessage.PaxosMessages.Id;

//import cn.com.sparkle.paxos.model.ElectionId;
//import cn.com.sparkle.paxos.model.Id;

public class NodeState {
	private String address;
	private long lastBeatHeatTime = 0;

	private Long lastCanExecuteInstanceId = -1l;
	private ElectionId lastElectionId = ElectionId.newBuilder()
			.setId(Id.newBuilder().setIncreaseId(-1).setAddress(""))
			.setVersion(-1).build();
	// new ElectionId(-1, "", -1);
	private boolean isMasterConnected = true;

	private boolean isConnected = false;;

	public NodeState(String address) {
		this.address = address;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public long getLastBeatHeatTime() {
		return lastBeatHeatTime;
	}

	public void setLastBeatHeatTime(long lastBeatHeatTime) {
		this.lastBeatHeatTime = lastBeatHeatTime;
	}

	public Long getLastCanExecuteInstanceId() {
		return lastCanExecuteInstanceId;
	}

	public void setLastCanExecuteInstanceId(Long lastCanExecuteInstanceId) {
		this.lastCanExecuteInstanceId = lastCanExecuteInstanceId;
	}

	public ElectionId getLastElectionId() {
		return lastElectionId;
	}

	public void setLastElectionId(ElectionId lastElectionId) {
		this.lastElectionId = lastElectionId;
	}

	public boolean isMasterConnected() {
		return isMasterConnected;
	}

	public void setMasterConnected(boolean isMasterConnected) {
		this.isMasterConnected = isMasterConnected;
	}

	public boolean isConnected() {
		return isConnected;
	}

	public void setConnected(boolean isConnected) {
		this.isConnected = isConnected;
	}

}
